﻿using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Core.Base.Module;
using Core.Interfaces;
using Core.Mgrs;
using Global.Mgr;
using Global.Model;
using UniRx;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Core.Base
{
    /// <summary>
    /// 所有游戏模块的基类
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class BaseGameModule : BaseModule
    {

        public virtual void OnInit(ITuple tuple = null)
        {
            KKGL.SysEvent.RegHandler(EGameLife.OnGameEnter, _OnGameEnter, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGameStart, _OnGameStart, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGamePause, _OnGamePause, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGameResume, _OnGameResume, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGameStop, _OnGameStop, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGameSettlement, _OnGameSettlement, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGameRestart, _OnGameRestart, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnGameExit, _OnGameExit, TokenSource.Token);
            KKGL.SysEvent.RegHandler(EGameLife.OnUseProp, _OnUseProp, TokenSource.Token);
        }

        protected virtual void _OnGameEnter(ITuple obj)
        {
        }

        protected virtual void _OnGameExit(ITuple obj)
        {
        }

        protected virtual void _OnGameStart(ITuple tuple)
        {
        }

        protected virtual void _OnGamePause(ITuple tuple)
        {
        }

        protected virtual void _OnGameResume(ITuple tuple)
        {
        }

        protected virtual void _OnGameSettlement(ITuple tuple)
        {
        }

        protected virtual void _OnGameStop(ITuple tuple)
        {
        }

        protected virtual void _OnUseProp(ITuple obj)
        {
        }

        protected virtual void _OnGameRestart(ITuple tuple)
        {
        }

        protected override void InitMgr()
        {
           
        }
    }

    /// <summary>
    /// 游戏结果
    /// </summary>
    public enum GameResult
    {
        Win,
        Fail,
    }
}